package edu.xjtu.jih.forgetpwd;

import edu.xjtu.jih.common.Utils;
import org.apache.ibatis.session.SqlSession;

public class FopwdService {
    public static void updatepwd(FopwdDto dto) {
        SqlSession sqlSession = Utils.openSession();

        try{
            FopwdDao dao = sqlSession.getMapper(FopwdDao.class);

            try {
                dao.updatePwd(dto);
            }catch (Exception e){
                e.printStackTrace();
            }
            //dao.insertUser(dto);
            sqlSession.commit();
        }catch(Exception e){
            sqlSession.rollback();
            throw new RuntimeException("修改密码失败！", e);
        }finally {
            sqlSession.close();
        }
    }
}
